var webdir='http://www.2admin.co.cc';
var limit=10;
var start=0;

var pageselect=1;
$(document).ready(function() {

//getsubmeeting();

}); 

function confirmpass()
{
    if(confirm('ยืนยันการใส่รหัส'))
    {
        getsubmeeting();
    }
}
function getUrlVars2() 
                  {
                  var vars = {};
                  var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
                  vars[key] = value;
                  });
                  return vars;
                  }
function getsubmeeting()
{
    
    $.post(webdir+'/ajax.php',{functioncall:'getsubmeeting',password1:$('#password1').val(),meetid:getUrlVars2()['meetid'],start:start,limit:limit} ,function(data) {
    var view;
     var myObject = eval('(' + data + ')');
            
            
            if(myObject.count>0)
            { 
                $('#downloadtable').html('');
            for (variable in myObject.data)
             {   
                 
                 var obj = myObject.data[variable]; 
               if(obj.pic)
               {
                   var pic=obj.cover;
               }else
               {
                   var pic='meeting_user.jpg';
               }
               var str=' <li><div class="member"><img  src="images/icon_doc.png"></div><div class="post"><strong>Filename :</strong>'+obj.detail+'<br><strong>Filetype :</strong>'+obj.filetype+'<br><strong>Upload Date :</strong>'+obj.createdate+'<span class="num green"><a href="'+webdir+'/uploads/'+obj.file+'"><img src="images/download.png" width="129" height="39"></a></span></div></li>';

               $('#downloadtable').append(str);  
          //   alert(variable) ;
         
             
             
  
            }
             var totalpage=Math.ceil((myObject.count)/(limit) );
             
             $('.pagebarUTH').html('');
             $('.pagebarUTH').append('<a href="javascript:;" title="Seite 2">จำนวน '+myObject.count+'</a>&nbsp;');
             if(totalpage!=1)
             {
                var previous= totalpage-1;
                 $('.pagebarUTH').append('<a href="javascript:changepage('+previous+');" title="Seite 2"><< Previous</a>&nbsp;');
             }
             
             for(var i=1;i<=totalpage;i++)
             {
                 if(i==pageselect)
                 {
                  var strlink='<span class="this-page">'+i+'</span>';   
                 }else
                 {
                  var strlink='<a href="javascript:changepage('+i+');" title="Seite 2">'+i+'</a>';    
                 }
                 $('.pagebarUTH').append(strlink);
                 
             }
             
             if(totalpage!=1)
             {
                var next= totalpage+1;
                 $('.pagebarUTH').append('<a href="javascript:changepage('+next+');" title="Seite 2">Next >></a>');
                 $('.pagebarUTH').append('<a href="javascript:changepage('+totalpage+');" title="Seite 2">Last</a>');
             }
            }
            else
            {
                alert(myObject.error);
            }
     
});
    
}
